package addon.w3.mdx.com;

import java.io.IOException;

import addon.w3.mdx.MDXCOM;
import addon.w3.mdx.LEDataInputStream;
import addon.w3.mdx.MDXException;

/**
 * MODL						// [Model]
	long	nbytes;
	ASCII	Name;				(0x150 bytes)
	long	???;				(0)
	float	BoundsRadius;
	float	MinExtx, MinExty, MinExtz;
	float	MaxExtx, MaxExty, MaxExtz;
	long	BlendTime;
 * @author madjk
 *
 */
public class MDXModelCOM extends MDXCOM {
	int length = -1;
	String name = null;
	int chunk1 = -1;
	float boundRadius;
	float minExt[];
	float maxExt[];
	int blendTime;
	
	public String getTag() {
		return "MODL";
	}
	
	public void _decode(LEDataInputStream ins) throws IOException, MDXException {
		length = ins.readInt();
		byte nameBytes[] = new byte[336];
		ins.read(nameBytes);
		name = new String(nameBytes);
		chunk1 = ins.readInt();
		boundRadius = ins.readFloat();
		minExt = new float[3];
		minExt[0] = ins.readFloat();
		minExt[1] = ins.readFloat();
		minExt[2] = ins.readFloat();
		maxExt = new float[3];
		maxExt[0] = ins.readFloat();
		maxExt[1] = ins.readFloat();
		maxExt[2] = ins.readFloat();
		blendTime = ins.readInt();
	}
	
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("TAG : "+getTag());
		sb.append("\n\tILEN : "+length);
		sb.append("\n\tNAME : "+name);
		sb.append("\n\tCHUNK1 : "+chunk1);
		sb.append("\n\tboundRadius : "+boundRadius);
		sb.append("\n\tminExt[3] : "+minExt[0]+" : "+minExt[1]+" : "+minExt[2]);
		sb.append("\n\tmaxExt[3] : "+maxExt[0]+" : "+maxExt[1]+" : "+maxExt[2]);
		sb.append("\n\tblendTime : "+blendTime);
		return sb.toString();
	}

	@Override
	public boolean isImplicitTag() {
		// TODO Auto-generated method stub
		return true;
	}
}
